package com.chixing.day04;

/**
 * JavaBean:(1) 无参构造函数 (2) get和set方法
 */
public class Car {
    //默认省略无参构造函数
    private int carId;
    private String carName;
    private String carColor;

    //有参、无参构成方法的重载
    //无参构造函数
    public Car() {

    }

    //如果已经定义了 有参构造函数
    //有参构造函数,则会把 默认的无参构造函数 覆盖,若还想使用无参构造函数,则需要 显式定义出来
    public Car(int carId, String carName) {
        this.carId = carId;
        this.carName = carName;
    }

    public Car(int carId, String carName, String carColor) {
        this(carId, carName);//调用 其他构造函数 /*必须放到第一行、构造方法里*/
//        this.carId = carId;
//        this.carName = carName;
        this.carColor = carColor;
    }

    public String getCarColor() {
        return carColor;
    }

    public void setCarColor(String carColor) {
        this.carColor = carColor;
    }

    public int getCarId() {
        return carId;
    }

    public void setCarId(int carId) {
        this.carId = carId;
    }

    public String getCarName() {
        return carName;
    }

    public void setCarName(String carName) {
        this.carName = carName;
    }
}
